package com.hulk.dryad.admin.mapstruct;

import com.hulk.dryad.admin.api.vo.DictTypeVO;
import com.hulk.dryad.admin.api.vo.DictVO;
import com.hulk.dryad.persistence.entity.DictType;
import com.hulk.dryad.persistence.struct.BasicStruct;
import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author hulk
 * @version 1.0
 * @date 2020/10/21 12:39 下午
 */
@Mapper
public interface DictTypeStruct extends BasicStruct<DictTypeVO, DictType> {

	DictTypeStruct INSTANCE = Mappers.getMapper(DictTypeStruct.class);


	@Override
	@Mappings({
	})
	DictType to(DictTypeVO source) ;

	@InheritConfiguration(name = "fromDictVO")
	List<DictVO> fromDictVOList(List<DictType> source);

	@Mappings({
			@Mapping(source = "dictName", target = "label"),
			@Mapping(source = "dictType", target = "value")
	})
	DictVO fromDictVO(DictType source);

}
